package com.zkb.modules.server.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zkb.common.util.StringUtils;
import com.zkb.modules.server.mapper.TServerInfoMapper;
import com.zkb.modules.server.model.TServerInfo;
import com.zkb.modules.server.service.TServerInfoService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * (TServerInfo)表服务实现类
 *
 * @author makejava
 * @since 2022-01-21 16:04:40
 */
@Service
public class TServerInfoServiceImpl extends ServiceImpl<TServerInfoMapper, TServerInfo> implements TServerInfoService {

    @Override
    public List<TServerInfo> pageServers(TServerInfo tServerInfo) {
        QueryWrapper<TServerInfo> queryWrapper = new QueryWrapper<TServerInfo>();
        if (StringUtils.isNotEmpty(tServerInfo.getHost())) {
            queryWrapper.like("host", tServerInfo.getHost());
        }
        if (StringUtils.isNotEmpty(tServerInfo.getUsername())) {
            queryWrapper.eq("username", tServerInfo.getUsername());
        }
        if (tServerInfo.getOwnerId()!=null) {
            queryWrapper.eq("owner_id", tServerInfo.getOwnerId());
        }
        return baseMapper.selectList(queryWrapper);
    }

}

